/*
 * get_mass.h
 *
 *  Created on: Apr 26, 2010
 *      Author: marchi
 */

#ifndef GET_MASS_H_
#define GET_MASS_H_
#include "typedefs.h"
#include "vec.h"

static void calc_recipbox(matrix box,matrix recipbox)
{
  /* Save some time by assuming upper right part is zero */
  real tmp=1.0/(box[XX][XX]*box[YY][YY]*box[ZZ][ZZ]);
  recipbox[XX][XX]=box[YY][YY]*box[ZZ][ZZ]*tmp;
  recipbox[YY][XX]=0;
  recipbox[ZZ][XX]=0;
  recipbox[XX][YY]=-box[XX][YY]*box[ZZ][ZZ]*tmp;
  recipbox[YY][YY]=box[XX][XX]*box[ZZ][ZZ]*tmp;
  recipbox[ZZ][YY]=0;
  recipbox[XX][ZZ]=(box[XX][YY]*box[YY][ZZ]-box[YY][YY]*box[XX][ZZ])*tmp;
  recipbox[YY][ZZ]=-box[YY][ZZ]*box[XX][XX]*tmp;
  recipbox[ZZ][ZZ]=box[XX][XX]*box[YY][YY]*tmp;
}

extern int
get_mass(real***,real***, real, real*,int,int,int,int, atom_id*, t_trxframe* );

#endif /* GET_MASS_H_ */
